package com.java2207.group1.controller;

import com.java2207.group1.common.LayuiPageVo;
import com.java2207.group1.common.R;
import com.java2207.group1.mapper.BasicMapper;
import com.java2207.group1.pojo.Basic;
import com.java2207.group1.service.BasicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
@RestController
@RequestMapping("/basic")
public class BasicController {

    @Autowired
    private BasicService basicService;

    @RequestMapping("/basicPageAll")
    public LayuiPageVo<Basic> basicPageAll(@RequestParam Map<String,Object> map){
        LayuiPageVo<Basic> basicLayuiPageVo = basicService.basicPageAll(map);
        return basicLayuiPageVo;

    }
    @RequestMapping("/delectBasic")
    public R delectBasic(int id){
        int i = basicService.delectBasic(id);
        if(i!=0){
            return R.ok();
        }
        return  R.error();
    }

    @RequestMapping("/updateBasic")
    public R updateBasic(Basic basic){
        int i = basicService.updateBasic(basic);
        if(i!=0){
            return R.ok();
        }
        return  R.error();
    }

    @RequestMapping("/addBasic")
    public R addBasic(Basic basic){
        int i = basicService.addBasic(basic);
        if(i!=0){
            return R.ok();
        }
        return  R.error();
    }
}
